﻿@model DAL.GuiGeZhi
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>User_Edit</title>
    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />
    <script src="~/lib/layui/layui.js"></script>
    <script src="~/js/jquery.min.js"></script>
</head>
<body>
    <form class="layui-form" action="/GuiGe/GuiGeEdit_Memory" method="post" id="User_Edit">
        <input type="hidden" name="Id" value="@Model.Id" class="layui-input" />
        <div class="layui-input-inline">
            <label class="layui-form-label">颜色名称</label>
            <div class="layui-input-inline">
                <input type="text" name="GuiGeZhiName" required lay-verify="required" value="@Model.GuiGeZhiName" placeholder="请输入颜色名称" autocomplete="off" class="layui-input" />
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
    <script>
        layui.use(['form', 'layer', 'upload'], function () {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer;
            //监听提交
            form.on('submit(formDemo)', function (data) {
                //使用ajax提交
                $.post("/GuiGe/GuiGeEdit_Memory", $("#User_Edit").serialize(), function res(res) {
                    if (res.success) {
                        layer.msg("修改成功", function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index);
                            //修改成功后刷新父界面
                            window.parent.location.reload();
                        });
                    }
                    else
                        layer.alert("修改失败:" + res.message, { icon: 5 });
                }, "json");
                return false; //不再进行传统提交
            });
        });
    </script>
</body>
</html>
